package com.example.park_management.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.example.park_management.config.Result_zzc;
import com.example.park_management.entity.Finance_zzc;
import com.example.park_management.entity.Invoice_zzc;
import com.example.park_management.entity.Processflow_zzc;
import com.example.park_management.service.FinanceService_zzc;
import com.example.park_management.service.InvoiceService_zzc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/invoice")
public class InvoiceController_zzc {
    @Autowired
    private InvoiceService_zzc invoiceService_zzc;

    @GetMapping("/list")
    private List<Invoice_zzc> list() {
        return invoiceService_zzc.list();
    }

    //查询（模糊查询,匹配）
    @PostMapping("/listP")
    public Result_zzc listP(@RequestBody Invoice_zzc invoice_zzc) {
        LambdaQueryWrapper<Invoice_zzc> lambdaQueryWrapper = new LambdaQueryWrapper();
        if(StringUtils.isNotBlank(invoice_zzc.getInvoicename())){
            lambdaQueryWrapper.eq(Invoice_zzc::getInvoicename, invoice_zzc.getInvoicename());
        }
        return Result_zzc.suc(invoiceService_zzc.list(lambdaQueryWrapper));
    }
}
